const fp = require('lodash/fp')
const {Maybe , Container } = require('./support')
let maybe = Maybe.of([5,6,1])
let ex1 = (functor) => {
  return functor.map(fp.map(fp.add(3)))
}
console.log(ex1(maybe));

let xs = Container.of(['do','ray','me','fa','so','la','ti','do'])
let ex2 = (functor) =>{
  return functor.map(fp.first)
}
console.log(ex2(xs));

let safeProp = fp.curry(function(x,o){
  return Maybe.of(o[x])
})
let user = {id:2,name:'Albert'}
let ex3 = (functor)=>{
  return safeProp('name')(functor).map(fp.first)

}
console.log(ex3(user));

let ex4 = function (n){
  return Maybe.of(n).map(parseInt)
}
console.log(ex4(5.24));

